From 15fedd65a83da2972563c5e7e054512f799f6d55 Mon Sep 17 00:00:00 2001 From: Juergen Gross Date: Fri, 15 Apr 2016 16:54:16 +0200 Subject: [PATCH] libxc: cpupools: adjust retry loop in xc_cpupool_removecpu() Commit 1ef6beea187b ("libxc: do some retries in xc_cpupool_removecpu() for EBUSY case") added a retry loop in xc_cpupool_removecpu() for the EBUSY case. As EBUSY was returned in multiple error situations the loop would have been executed in situations where a retry would not be successful. Additionally calling sleep(1) between the rerires is a bad idea when being called in a daemon. The hypervisor has been changed to return different error values now. The retry added in above mentioned commit should be done in the EADDRINUSE case now. As the error condition should last only for a very short time, the sleep(1) call can be removed. Requested-by: Ian Jackson Signed-off-by: Juergen Gross Acked-by: Ian Jackson Reviewed-by: Dario Faggioli Reviewed-by: Alan Robinson Release-acked-by: Wei Liu --- tools/libxc/xc_cpupool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/libxc/xc_cpupool.c b/tools/libxc/xc_cpupool.c index 261b9c956e..bb99e3bed3 100644 --- a/tools/libxc/xc_cpupool.c +++ b/tools/libxc/xc_cpupool.c @@ -139,7 +139,7 @@ int xc_cpupool_addcpu(xc_interface *xch, } /* - * The hypervisor might return EBUSY when trying to remove a cpu from a + * The hypervisor might return EADDRINUSE when trying to remove a cpu from a * cpupool when a domain running in this cpupool has pinned a vcpu * temporarily. Do some retries in this case, perhaps the situation * cleans up. @@ -160,9 +160,7 @@ int xc_cpupool_removecpu(xc_interface *xch, sysctl.u.cpupool_op.cpu = (cpu < 0) ? XEN_SYSCTL_CPUPOOL_PAR_ANY : cpu; for ( retries = 0; retries < NUM_RMCPU_BUSY_RETRIES; retries++ ) { err = do_sysctl_save(xch, &sysctl); - if ( err < 0 && errno == EBUSY ) - sleep(1); - else + if ( err == 0 || errno != EADDRINUSE ) break; } return err; -- 2.30.2